import dashboardRequest from '@/utils/dashboardRequest'

// 获取区域管理列表
export const getAreaList = (params) => dashboardRequest({
  url: '/vm-service/region/search',
  params
})

// 删除区域
export const delArea = (id) => dashboardRequest({
  url: `/vm-service/region/${id}`,
  method: 'delete'
})

// 获取区域详情
export const checkArea = (params) => dashboardRequest({
  url: '/vm-service/node/search',
  params
})

// 新增区域
export const addArea = (data) => dashboardRequest({
  url: '/vm-service/region',
  method: 'post',
  data
})

// 修改区域
export const editArea = (data) => dashboardRequest({
  url: `/vm-service/region/${data.id}`,
  method: 'put',
  data
})

// ------------------------------------------------------------

// 点位信息列表
export const getNodeList = (params) => dashboardRequest({
  url: '/vm-service/node/search',
  params
})

// 删除点位
export const delNode = (id) => dashboardRequest({
  url: `/vm-service/node/${id}`,
  method: 'delete'
})

// 获取点位详情
export const checkNode = (id) => dashboardRequest({
  url: `/vm-service/node/vmList/${id}`
})

// 获取商圈信息
export const getBusinessType = () => dashboardRequest({
  url: '/vm-service/businessType'
})

// 获取合作商信息
export const getPartner = () => dashboardRequest({
  url: '/user-service/partner/search?pageIndex=1&pageSize=100000'
})

// 新增点位
export const addNode = (data) => dashboardRequest({
  url: '/vm-service/node',
  method: 'post',
  data
})

// 修改点位
export const editNode = (data) => dashboardRequest({
  url: `/vm-service/node/${data.id}`,
  method: 'put',
  data
})

// ------------------------------------------------------------

// 点位信息列表
export const getPartnerList = (params) => dashboardRequest({
  url: '/user-service/partner/search',
  params
})

// 删除合作商
export const delPartner = (id) => dashboardRequest({
  url: `/user-service/partner/${id}`,
  method: 'delete'
})

// 新增点位
export const addPartner = (data) => dashboardRequest({
  url: '/user-service/partner',
  method: 'post',
  data
})

// 修改合作商
export const editPartner = (data) => dashboardRequest({
  url: `/user-service/partner/${data.id}`,
  method: 'put',
  data
})

// 重置密码
export const resetPassword = (id) => dashboardRequest({
  url: `/user-service/partner/resetPwd/${id}`,
  method: 'put'
})
